home *** CD-ROM | disk | FTP | other *** search
/ Go64! / Go64_2000-07_2000_CSW_Side_B.d64 / bmh-ma 1 (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  650b  |  30 lines

  1. 1 g=0
  2. 2 print"[147]"
  3. 10 t$="abraham says abracadabra but nothing moves at all. "
  4. 15 t$=t$+"so abraham decides to forget about the abracadabra thing and moves "
  5. 16 t$=t$+"the table using his hands."
  6. 17 rem
  7. 18 rem
  8. 19 dim y(127):fora=0to127:y(a)=1:next
  9. 20 input "suchwort";p$:ts=ti
  10. 21 n=len(t$)
  11. 22 m=len(p$)
  12. 100 rem boyer moore horspool
  13. 110 rem -- vorverarbeitung von p --
  14. 120 for a=64 to 91
  15. 130 y(a)=m
  16. 140 next a
  17. 150 for j=1 to m-1
  18. 155 y(asc(mid$(p$,j,1)))=m-j
  19. 170 next j
  20. 190 rem ---  suche ---
  21. 200 s=1
  22. 220 for j = m to 2 step -1
  23. 230 if mid$(p$,j,1)<>mid$(t$,s+j-1,1) goto 260
  24. 240 next j
  25. 250 g=g+1
  26. 260 s=s+y(asc(mid$(t$,s+j-1,1)))
  27. 270 if s<= n-m+1 goto 220
  28. 280 print"der string wurde";g;"mal gefunden"
  29. 290 printti-ts
  30.